package com.yh.doing.state_pattern.file;


/**
 * @program: design-patterns
 * @description: ${description}
 * @author: yangh0597@163.com
 * @date: 2021-03-11 23:31
 * @problem:
 **/
public class Context {
    public final static 完全锁定FileState 完全锁定File = new 完全锁定FileState();
    public final static 未锁定FileState 未锁定File = new 未锁定FileState();
    public final static 锁定FileState 锁定File = new 锁定FileState();
    private FileState currentStatus;


    public void setCurrentStatus(FileState currentStatus) {
        this.currentStatus = currentStatus;
        this.currentStatus.setContext(this);
    }

    public FileState getCurrentStatus() {
        return currentStatus;
    }

    public void updateFile() {
        this.currentStatus.updateFile();
    }
    public void delete() {
        this.currentStatus.delete();
    }
    public void select() {
        this.currentStatus.select();
    }
    public void 锁定() {
        this.currentStatus.锁定();
    }
    public void 取消锁定() {
        this.currentStatus.取消锁定();
    }

    public  void 完全锁定(){
        this.currentStatus.完全锁定();
    }
}
